const HtmlToPug= require("./lib/lib");
const _ = require("lodash");
const {AsyncWriteFile} = require("./utils");

//具有template 和 v-if 的组合情况
const testHtml1 = `
<div class="orderPageList" :class="{'MT-40': pageType === 2,'orderPageList_max': pageType === 2}">
        <Spin :spinning="tableLoading">
            <div class="orderPageList-body">
                <a-table
                        v-if="orderInfo.list.length !== 0"
                        ref="table"
                        :columns="columns"
                        :dataSource="orderInfo.list"
                        bordered
                        size="middle"
                        :pagination="false"
                        :scroll="{ x: true }"
                >
                    <template slot="progress" slot-scope="text,record">
                        <Tooltip :title="text">
                            <div v-clipboard:success="onCopy" v-clipboard:copy="text" :style="{width:'80px',whiteSpace:'nowrap',textOverflow:'ellipsis',overflow:'hidden'}">{{text}}</div>
                        </Tooltip>
                    </template>
                    <template slot="emptyValue" slot-scope="text,recode">
                        <div v-if="!!text">{{text}}</div>
                        <div style="color: rgba(255,0,0,0.39)" v-else>
                            暂无数据
                        </div>
                    </template>
                </a-table>
                <div class="orderPageList-body-empty" v-else>
                    <Empty ></Empty>
                </div>
            </div>
            <div class="orderPageList-footer MT-10">
                <Pagination :current="page" @change="pageChange" :total="orderInfo.total"/>
            </div>
        </Spin>

        <Modal v-model='fileModalVis' title="文件列表" :footer="false">
            <div class="orderPageList-download">
                <download-list :show-btn="false" :list="fileList" />
            </div>
        </Modal>
    </div>
`

//具有slot 的情况
const testSlotHtml = `
    <div>
        <a-card>
            <div slot="title" v-if="1">123123</div>
            <div slot="title" v-else-if="2"></div>
            <div slot="title" v-else></div>
            <div>1234</div>
        </a-card>
    </div>
`

const testSlotHtmlNoIf = `
    <div>
        <a-card>
            <div slot="title" >123123</div>
            <div slot="title" ></div>
            <div slot="title" ></div>
            <div>1234</div>
        </a-card>
    </div>
`


let t1 = new HtmlToPug(testHtml1);
console.log(t1.text,t1.ast)
AsyncWriteFile("./test.pug", t1.text).then(r => {})

